package org.csu.demo.aop.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class ProxyDemo implements InvocationHandler {
    private Object object;

    public ProxyDemo(Object object){
        this.object = object;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        if(method.getName().equals("insert")){
            System.out.println("****前置建议————日志记录");
        }
        Object proxyObject = method.invoke(object,args);
        System.out.println("****后置建议————日志记录");

        return  proxyObject;
    }
}
